//
//  MCBaseVc.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/5/3.
//

import UIKit
import QMUIKit

class MCBaseVc: UIViewController {

    lazy var navBtn:UIButton = {
        let backBtn = UIButton(type: .custom)
        return backBtn
    }()
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.black
//        configNavigationBar()
    }
    
    deinit {
        debugPrint("😄😄😄-------------——释放了")
    }
    
    func configNavigationBar() {
            guard let navi = navigationController else { return }
    //        navi.navigationBar.setBackgroundImage(UIImage(), for: .default)
    //        navi.navigationBar.shadowImage = UIImage()
            if navi.visibleViewController == self {
//                navi.disablePopGesture = false
    //            navi.barStyle(.white)
                navi.setNavigationBarHidden(false, animated: true)
                if navi.viewControllers.count > 1 {
    //                let backBtn = EnlargeEdgeButton(type: .custom)
//                    navBtn.enlargeEdge = UIEdgeInsets(top: 5, left: 10, bottom: 5, right: 10)
                    navBtn.setImage(UIImage.init(named: "nav_back"), for: .normal)
                    navBtn.addTarget(self, action: #selector(pressBack), for: .touchUpInside)
                    navigationItem.leftBarButtonItem  = UIBarButtonItem.init(customView: navBtn)
                }
            }
        }
    @objc func pressBack() {
        navigationController?.popViewController(animated: true)
    }
    
//    override func setupNavigationItems() {
//        super.setupNavigationItems()
//
//        if (self.qmui_isPresented()) {
//            self.navigationItem.leftBarButtonItem = UIBarButtonItem.qmui_close(withTarget: self, action: #selector(handleCloseItem))
//        }
//    }
    
//    @objc func handleCloseItem() -> Void {
//        self.dismiss(animated: true)
//    }
//
//    override func shouldCustomizeNavigationBarTransitionIfHideable() -> Bool {
//        return true
//    }
    
}

